////<!--非系统开闸-->
import api from '../../../fetch/api'

export default {
    data() {
        return {
            bigImgPath: '',
            bindingCarCodeList:[]
        }
    },
    created() {
        // this.getItemList();
    },
    methods: {
        // 查看已绑定的车牌号
        checkBindingCarCode(row,modalName){
            let self = this
            self.bindingCarCodeList = []
            let params = {
                logicCardCode: row.carCode
            }
            API.fetchGet('monthTicketBill/getLogicCardCodeDetail',params).then(res=>{
                if(res.data){
                    let data = res.data
                    let obj = {
                      carCode: data.logicCardCode, //车牌
                    }
                    if(data.openid){ //微信
                      obj.cardCode = data.nickname //备注卡号
                    }else{
                      obj.cardCode = data.cardCode //备注卡号
                    }
                    self.bindingCarCodeList.push(obj)
                }
                self.toOpenModal(modalName)
            },err=>{})
        },
        getList() {
            let params = $.extend({}, this.searchParams, this.otherParams);
            if(params.hasOwnProperty("carCode")){
                delete params.carCode
                let attribStr = this.searchList[1].value
                params[attribStr] = this.searchList[1].inputVal
            }
            console.log(this.otherParams)
            this.getItemList(params);
        },
        showBigImgModal(name, path) {
            this.bigImgPath = path;
            this.toOpenImgModal(name, path);
        },
        //获取列表
        getItemList(aparams) {
            let self = this,
                params = {
                    page: this.pageNumber,
                    rp: this.pageSize
                };
            self.tbodysInfo = []
            params = $.extend({}, params, aparams);
            api.fetchGet('/park/parkAbnormalOpenGateCar/getParkAbnormalOpenGateCar.do', params)
                .then(res => {
                    let data = res.data,
                        list = data.rows;
                    self.tbodysInfo = list
                    self.total = data.total;
                }, err => { })
        },
        exportData() {
            let self = this;
            let theadsArr = []
            for (let i = 0; i < self.theadsInfo.length; i++) {
                if (self.theadsInfo[i].checked) {
                    theadsArr.push(self.theadsInfo[i].prop)
                }
            }
            let params = {
                meterList: theadsArr.join(',')
            };

            params = $.extend({}, params, this.searchParams, this.otherParams);
            if(params.hasOwnProperty("carCode")){
                delete params.carCode
                let attribStr = this.searchList[1].value
                params[attribStr] = this.searchList[1].inputVal
            }
            self.showDialog("确认导出该报表?", '', function () {
                self.toExportAsync('park/parkAbnormalOpenGateCar/exportParkAbnormalOpenGateCar.do', params)
            })

        },
         // 处理访问不了的图片
        handleImg(e,rowObj){
            if(e.target.className=='carNoImageUrl'){ //小图
                rowObj.carNoImageUrl = null
            }else if(e.target.className=='carImageUrl'){ //大图
                if(rowObj.recordType=='IN_PARK'){ //进场
                    rowObj.carImageUrl = rowObj.carImageUrl.replace(/ABNORMAL/,'CAR_IN')
                }else if(rowObj.recordType=='OUT_PARK'){ //离场
                    rowObj.carImageUrl = rowObj.carImageUrl.replace(/ABNORMAL/,'CAR_OUT')
                }
            }
        },
    }
}